Skip to content

Add imported ENS domain support#953

Merged
0xh3rman merged 2 commits intomainfrom
imported-ens
Feb 18, 2026
Merged

Add imported ENS domain support#953
0xh3rman merged 2 commits intomainfrom
imported-ens

Conversation

@0xh3rman
Copy link
Collaborator

  • Refactor Client::resolve to select the best provider by longest domain match (with wildcard support) via a new matched_provider helper and domain_match_len function; prefer more specific provider results and propagate their errors. Add a NameError type for clearer error construction and export the error module.
  • Introduce a TestProvider testkit (testkit.rs) to simplify provider mocking and add unit tests covering domain preference and error propagation. Extend ENS client domains (eth, com, xyz, dev) and add an integration test for resolving an imported ENS name.
  • Also export the testkit module from lib.rs.

Refactor Client::resolve to select the best provider by longest domain match (with wildcard support) via a new matched_provider helper and domain_match_len function; prefer more specific provider results and propagate their errors. Add a NameError type for clearer error construction and export the error module. Introduce a TestProvider testkit (testkit.rs) to simplify provider mocking and add unit tests covering domain preference and error propagation. Extend ENS client domains (eth, com, xyz, dev) and add an integration test for resolving an imported ENS name. Also export the testkit module from lib.rs.
@semanticdiff-com
Copy link

semanticdiff-com bot commented Feb 18, 2026

Review changes with  SemanticDiff

Changed Files
File Status
  crates/name_resolver/src/client.rs  15% smaller
  crates/primitives/src/name.rs  15% smaller
  crates/name_resolver/src/ens/client.rs  0% smaller
  crates/name_resolver/src/error.rs  0% smaller
  crates/name_resolver/src/lib.rs  0% smaller
  crates/name_resolver/src/testkit.rs  0% smaller
  crates/name_resolver/tests/integration_test.rs  0% smaller

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @0xh3rman, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the name resolution system by improving how name providers are selected and errors are handled. It introduces a more sophisticated matching algorithm for domains, expands the range of supported ENS domains, and provides a dedicated test utility for easier mocking. These changes collectively make the name resolution process more reliable, flexible, and testable, ultimately supporting a wider array of domain name services.

Highlights

  • Refactored Name Resolution Logic: The Client::resolve method was refactored to use a new matched_provider helper function, which selects the best name provider based on the longest domain match, including wildcard support. This ensures more specific provider results are preferred and their errors are propagated.
  • Enhanced Error Handling: A new NameError type was introduced for clearer error construction and exported for broader use within the crate.
  • Improved Testability with TestKit: A TestProvider testkit was added to simplify provider mocking, enabling more robust unit tests for domain preference and error propagation.
  • Expanded ENS Domain Support: The ENS client now supports additional domains, including 'com', 'xyz', and 'dev', alongside the existing 'eth' domain.
  • New Integration Test: An integration test was added to verify the resolution of imported ENS names, such as 'farcaster.xyz'.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • crates/name_resolver/src/client.rs
    • Imported NameError for consistent error handling.
    • Refactored resolve method to delegate provider selection to matched_provider.
    • Added matched_provider function to select the best provider based on domain match length and index.
    • Implemented domain_match_len helper function for calculating domain match specificity, including wildcard support.
    • Introduced new unit tests for test_resolve_prefers_longer_domain_match and test_resolve_returns_more_specific_provider_error.
  • crates/name_resolver/src/ens/client.rs
    • Extended the list of supported ENS domains to include 'com', 'xyz', and 'dev'.
  • crates/name_resolver/src/error.rs
    • Created a new file defining the NameError struct, implementing Display and Error traits for custom error types.
  • crates/name_resolver/src/lib.rs
    • Exported the new error module.
    • Conditionally exported the new testkit module for test environments.
  • crates/name_resolver/src/testkit.rs
    • Created a new file defining TestProvider struct for mocking NameClient implementations in tests.
    • Implemented NameClient trait for TestProvider to simulate name resolution responses.
  • crates/name_resolver/tests/integration_test.rs
    • Added test_resolver_ens_imported_name integration test to verify resolution of 'farcaster.xyz' on Ethereum.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

The pull request introduces a more robust domain matching logic for name resolution, allowing for specific provider selection based on the longest domain match and supporting wildcards. It also adds a useful testkit for mocking providers and expands ENS support to more TLDs. The refactoring improves maintainability and correctness. Some minor efficiency improvements are suggested for the matching logic to avoid unnecessary allocations and improve code clarity.

@0xh3rman 0xh3rman merged commit af382fc into main Feb 18, 2026
4 checks passed
@0xh3rman 0xh3rman deleted the imported-ens branch February 18, 2026 11:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant